<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
if (strpos($_SERVER['HTTP_HOST'], 'localhost') !== false) {
    defined('YII_DEBUG') or define('YII_DEBUG',true);
    defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
    define('YII_ENV', 'dev');
} else {
    defined('YII_DEBUG') or define('YII_DEBUG',false);
    defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',1);
    define('YII_ENV', 'production');
}

return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'Yexa',

	'behaviors' => array(
		'fconfig' => array(
			'class' => 'ext.FlexibleConfig.FConfig',
			'currentConfig' =>  YII_ENV,
			'configs' => array(
				'dev' => array(),
				'production' => array(),
				'test' => array(),
			),
		),
	),
	'params'=>array(
        'adminEmail'=>'ekaragodin@gmail.com',
    ),

	// preloading 'log' component
	'preload'=>array('log', 'sanitizer'),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.components.*',
		'application.modules.user.models.*',
		'application.modules.user.components.*',
		'application.helpers.*',
		'application.extensions.yiidebugtb.*',
		'ext.giix-components.*',
		'application.modules.rights.*',
		'application.modules.rights.components.*',
	),

	'modules'=>array(
		'rights' => array(
			'install' => true,
		),
		'user',
		// uncomment the following to enable the Gii tool

		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'root',
		 	// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
			'generatorPaths' => array('ext.gtc'
			),
		),
	),

	// application components
	'components'=>array(
		'browser' => array(
			'class' => 'application.extensions.browser.CBrowserComponent',
		),
		'clientScript' => array(
			'class' => 'ext.minify.EClientScript',
			'combineScriptFiles' => true, // By default this is set to false, set this to true if you'd like to combine the script files
			'combineCssFiles' => true, // By default this is set to false, set this to true if you'd like to combine the css files
			'optimizeCssFiles' => false,  // @since: 1.1
			'optimizeScriptFiles' => false,   // @since: 1.1
		),
		'sanitizer' => array(
			"class" => 'application.extensions.ESanitizer',
			'sanitizeGet' =>false,
			'sanitizePost' => true,
			'sanitizeCookie' => true,

		),
		'config' => array(
			'class' => 'application.extensions.EConfig',
		),
		'viewRenderer'=>array(
			'class'=>'application.extensions.yiiext.renderers.smarty.ESmartyViewRenderer',
			'fileExtension' => '.tpl',
			//'pluginsDir' => 'application.smartyPlugins',
			//'configDir' => 'application.smartyConfig',
		),
		'email'=>array(
			'class'=>'application.extensions.email.Email',
			'delivery'=>'php', //Will use the php mailing function.  
			//May also be set to 'debug' to instead dump the contents of the email into the view
		),
		'CURL' =>array(
			'class' => 'application.extensions.curl.Curl',
			//you can setup timeout,http_login,proxy,proxylogin,cookie, and setOPTIONS
		),
		'file' => array(
			'class' => 'application.extensions.file.CFile',	
		),	
		'image' => array(
			'class' => 'application.extensions.image.CImageComponent',	
			'driver' => 'GD',
			'params' => array('directory' => '/opt/local/bin'),
		),
		'user'=>array(
			// enable cookie-based authentication
			'allowAutoLogin'=>true,
			'loginUrl' => array('/user/login'),
		),
		'authManager' => array(
			'class' => 'RDbAuthManager',	
		),
		// uncomment the following to enable URLs in path-format
		'urlManager'=>array(
			'urlFormat'=>'path',
			'rules'=>array(
				'<controller:\w+>/<id:\d+>'=>'<controller>/view',
				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
			),
		),
		/*'db'=>array(
			'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
		),
		 */
		// uncomment the following to use a MySQL database
		'db'=>array(
			'connectionString' => 'mysql:host=localhost;dbname=yiicms_dev',
			'emulatePrepare' => true,
			'username' => 'root',
			'password' => 'root',
			'charset' => 'utf8',
			'tablePrefix' => 'yiicms_'
		),
		'errorHandler'=>array(
			// use 'site/error' action to display errors
            'errorAction'=>'site/error',
        ),
		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning, trace',
				),
				array( // configuration for the toolbar
					'class'=>'XWebDebugRouter',
					'config'=>'alignLeft, opaque, runInDebug, fixedPos, collapsed, yamlStyle',
					'levels'=>'error, warning, trace, profile, info',
					'allowedIPs'=>array('127.0.0.1','192.168.1.54'),
				),
				// uncomment the following to show log messages on web pages
				/*
				array(
					'class'=>'CWebLogRoute',
				),
				*/
			),
		),
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=>array(
		// this is used in contact page
		'adminEmail'=>'jianjian19841984@gmail.com',
	),
);
